package cn.webestar.scms.user.api;

import cn.webestar.scms.commons.R;
import cn.webestar.scms.commons.api.PageVO;
import cn.webestar.scms.user.api.dto.Role.*;
import cn.webestar.scms.user.entity.Role;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 角色
 */
@Tag(name = "角色")
@FeignClient(contextId = "Role", name = "microsvc-user", path = "/svcapi/Role")
public interface RoleApi {

    @Operation(summary = "create")
    @PostMapping("create")
    R<Role> create(@RequestBody RoleCreateDTO body);

    @Operation(summary = "delete")
    @PostMapping("delete")
    R<Boolean> delete(@RequestParam("id") Long id);

    @Operation(summary = "update")
    @PostMapping("update")
    R<Role> update(@RequestBody RoleUpdateDTO body);

    @Operation(summary = "findById")
    @PostMapping("findById")
    R<Role> findById(@RequestParam("id") Long id);

    @Operation(summary = "findByIds")
    @PostMapping("findByIds")
    R<Map<Long, Role>> findByIds(@RequestBody Set<Long> ids);

    @Operation(summary = "page")
    @PostMapping("page")
    R<PageVO<Role>> page(@RequestBody RolePageDTO body);

    @Operation(summary = "findOne")
    @PostMapping("findOne")
    R<Role> findOne(@RequestBody RoleSimpleDTO body);

    @Operation(summary = "limitList")
    @PostMapping("limitList")
    R<List<Role>> limitList(@RequestBody RoleLimitDTO body);

    @Operation(summary = "findByEmpId")
    @PostMapping("findByEmpId")
    R<List<Role>> findByEmpId(@RequestParam("empId") Long empId);

}
